package com.nuoniu.sibanyun.controller.crm;


import com.nuoniu.sibanyun.common.BaseController;
import com.nuoniu.sibanyun.common.result.HttpResult;
import com.nuoniu.sibanyun.entity.crm.CrmUserField;
import com.nuoniu.sibanyun.service.crm.ICrmUserFieldService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 用户显示字段策略 前端控制器
 * </p>
 *
 * @author baiqiang
 * @since 2020-06-23
 */
@RestController
@RequestMapping("/crm/userField")
@Api(tags = "用户显示字段策略", value = "用户显示字段策略")
public class CrmUserFieldController extends BaseController {

    @Autowired
    private ICrmUserFieldService fieldService;

    /**
     * 保存用户用户字段
     * @author 小啊刚
     * @date 2020/6/22
     */
    @PostMapping("save")
    public HttpResult saveCrmFiled(@RequestBody CrmUserField field) {
        if(field != null && field.getType() != null) {
            fieldService.saveCrmFiled(field);
        }
        return HttpResult.ok();
    }

    /**
     * 获取用户字段详情
     * @author 小啊刚
     * @date 2020/6/23
     */
    @GetMapping("detail")
    public HttpResult detail(CrmUserField field) {
        return HttpResult.ok(fieldService.detail(field));
    }
}
